package com.sl.biz.modular.views.controller;

import com.sl.biz.modular.views.dao.domain.entity.ViewConfigDO;
import com.sl.biz.modular.views.service.ViewConfigBizService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/view_config")
@RequiredArgsConstructor
public class ViewConfigController {

    private final ViewConfigBizService viewConfigBizService;

    @PostMapping("/list")
    public List<ViewConfigDO> list(@RequestBody ViewConfigDO viewConfigDO) {
        return viewConfigBizService.list(viewConfigDO);
    }

    @PostMapping("/remove_by_id")
    public Boolean removeById(@RequestBody ViewConfigDO processComp) {
        return viewConfigBizService.removeById(processComp);
    }

    @PostMapping("/save_view_content")
    public Boolean saveViewContent(@RequestBody ViewConfigDO processComp) {
        return viewConfigBizService.saveViewContent(processComp);
    }

    @PostMapping("/offline")
    public Boolean offline(@RequestBody ViewConfigDO processComp) {
        return viewConfigBizService.offline(processComp);
    }

    @PostMapping("/online")
    public Boolean online(@RequestBody ViewConfigDO processComp) {
        return viewConfigBizService.online(processComp);
    }


    @PostMapping("/save")
    public String save(@RequestBody ViewConfigDO processComp) {
        return viewConfigBizService.save(processComp);
    }

    @PostMapping("/get_by_id")
    public ViewConfigDO getById(@RequestBody @Validated ViewConfigDO addRequest) {
        return viewConfigBizService.getById(addRequest);
    }
    @PostMapping("/get_by_path")
    public ViewConfigDO getByPath(@RequestBody @Validated ViewConfigDO addRequest) {
        return viewConfigBizService.getByPath(addRequest);
    }



}
